/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package homework.demo04;

/**
 *
 * @author Administrator
 */
public class CheckEmail {
    public static void main(String[] args) {           
        String email = "448299700@qq.com";           
        boolean flag = true;                    
        if (email.length()                   
                < 5) {               
            flag = false;           
        }           
        if(!(email.endsWith(".com"))){                 
            flag=false;               
        }           
        String string="abcdefghijklmnopqrstuvwxyz0123456789";           
        for(int i=0;i<email.length();i++){               
            char c=email.charAt(i);               
            int temp=string.indexOf(c);               
            if(temp<0){                  
                flag=false;                  
                break;               
            }           
        }           
        if(flag){               
            System.out.println("是合法的email");           
        }else{               
            System.out.println("不是合法的email");           
        }                                        
    }   
}   


